{include file="public/layout" /}
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15>
                    <div class="layui-form" wid100 lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">文档属性</label>
                            <div class="layui-input-inline">
                                {eq name="channel" value="9"}
                                <input type="checkbox" value="1" name="is_head" lay-skin="primary" title="刚需[h]">
                                <input type="checkbox" value="1" name="is_recom" lay-skin="primary" title="推荐[c]">
                                <input type="checkbox" value="1" name="is_special" lay-skin="primary" title="特推[a]" >
                                <input type="checkbox" value="1" name="is_b" lay-skin="primary" title="热销[b]" >
                                <input type="checkbox" value="1" name="is_litpic" lay-skin="primary" title="图片[p]">
                                <input type="checkbox" value="1" name="is_sale" lay-skin="primary" title="特价[s]">
                                <input type="checkbox" value="1" name="is_moods" lay-skin="primary" title="人气[m]">
                                {/eq}
                                {eq name="channel" value="1"}
                                <input type="checkbox" value="1" name="is_head" lay-skin="primary" title="头条[h]">
                                <input type="checkbox" value="1" name="is_recom" lay-skin="primary" title="推荐[c]">
                                <input type="checkbox" value="1" name="is_special" lay-skin="primary" title="幻灯[a]" >
                                <input type="checkbox" value="1" name="is_b" lay-skin="primary" title="加粗[b]" >
                                <input type="checkbox" value="1" name="is_litpic" lay-skin="primary" title="图片[p]">
                                {/eq}
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="aids" id="aids" value="">
                                <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        layui.config({
            base: '__SKIN__/' //静态资源所在路径
            ,version: '{$version}'
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'set'], function(){
            var $ = layui.$
                ,layer = layui.layer
                ,form = layui.form;

            var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            $('#aids').val(parent.get_aids());

            //监听提交
            form.on('submit(formSubmit)', function(data){
                var load = layer_loading();
                data.field._ajax = 1;
                $.ajax({
                    type : 'post',
                    url : "{$form_action|default=''}",
                    data : data.field,
                    dataType : 'json',
                    success : function(res){
                        layer.close(load); //关闭loading
                        if(res.code == 1){
                            parent.layer.msg(res.msg, {shade: 0.3, time: 1000}, function(){
                                parent.window.location.reload();
                                parent.layer.close(parentObj);
                            });
                        }else{
                            showErrorMsg(res.msg);
                        }
                    },
                    error: function(e){
                        layer.close(load); //关闭loading
                        showErrorAlert();
                    }
                });
                return false;
            });

        });

    </script>
    {include file="public/footer" /}